<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\ArcClassify */

$this->title = "";
$this->params['breadcrumbs'][] = ['label' => '分类种类', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '查看';
?>
<a id="back" class="btn btn-default pull-left" href="index" ><i class="fa fa-backward"></i> 返回列表页</a>
<div class="help-block" style="height: 30px"></div>
<div class="arc-classify-view">

    <h3><?=$model->name?></h3>
    <h4>点击以下的按钮以更新、修改</h4>

    <p>
        <?= Html::a('修改', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => '你确定要删除该条文件吗?',
                'method' => 'post',
            ],
        ]) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'name',
            //'content:ntext',
 			[ 	'attribute'=>'content',
 				'code'=>true,
 				'value'=>
 					function ($model){
    					$contentArr = explode("|", $model->content);
    					$str = '';
    					foreach ($contentArr as $k => $v){
    						if(!empty($v) && $v!='' ){
	    						$str .= '<button labelbutton="true" class="btn btn-default btn-flat">'.$v.'</button>';
    						}
    					}
    					return $str;
    				},
                'format' => 'raw',//表示显示的是html格式的
    			'label'=>'<div id="labelButon">内容解析标签<div>',
    		],
        ],
        // 'template' 属性调整表格每一行的样式
        'template' => '<tr><th style="width: 120px;">
        					{label}</th>
            		<td style="word-wrap:break-word;
            		word-break:break-all;
            		max-height:300px;
            		display: -webkit-box;-webkit-line-clamp: 6;
            		-webkit-box-orient: vertical;
            		overflow: auto;">
            		<div style="overflow:auto">
            		{value}
            		</div>
            		</td>
            		</tr>', 
    ]) ?>
    
</div>

<script type="text/javascript">
$(function(){
	//var labelButton = $("#labelButon").parent().next().children();
	//var labelButtonText = labelButton.text();
	//labelButton.html(labelButtonText);

})();
</script>
